<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <!-- 移动端设置不缩放 -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>种类</title>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
        <link rel="stylesheet" th:href="@{/css/common.css}">
        <link rel="stylesheet" th:href="@{/css/types.css}">
    </head>
    <body>
        <!-- navbar -->
        <nav th:replace="_fragment::navbar(1)"></nav>
        
        <!-- content -->
        <div>
            <div class="container">
                <div class="row m-container">
                    <div class="col-sm-8 col-sm-offset-2">
                        <!-- top -->
                        <div class="panel panel-default panel-body">
                            <h3 class="inline">分类</h3> <span class="pull-right">共 <h3 class="inline" th:text="${pages.total}"></h3> 篇</span>
                        </div>
                        <!-- types -->
                        <div class="panel panel-default panel-body">
                            <ul class="nav nav-pills types" role="tablist">
                                <li th:each="type: ${types}" th:class="${type.id == typeId ? 'active' : null}" role="presentation">
                                    <a th:href="@{/types(typeId=${type.id}, index=${pages.current})}">
                                        [[${type.name}]]
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <!-- content -->
                        <ul class="list-group">
                            <li class="list-group-item" th:each="homeBlog, iterStat: ${pages.getRecords()}" th:object="${homeBlog}">
                                <div class="row">
                                    <div class="col-xs-8 padding" th:classappend="${'auto-center-src-' + iterStat.count}">
                                        <h4 class="title"><a th:href="@{/detail(id=*{id})}" th:text="*{title}"></a></h4>
                                        <p class="summary" th:text="*{summary}"></p>
                                        <div class="row">
                                            <div class="col-xs-9">
                                                <ul class="list-inline">
                                                    <li>
                                                        <img class="user-icon img-thumbnail img-circle" th:src="*{avatar}" alt="">
                                                        <a href="/about" th:text="*{nick}">IllTamer</a>
                                                    </li>
                                                    <li>
                                                        <span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>
                                                        <span th:text="*{#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}"></span>
                                                    </li>
                                                    <li>
                                                        <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
                                                        <span th:text="*{views}"></span>
                                                    </li>
                                                </ul>
                                            </div>
                                            <div class="col-xs-3 duplicate-tag">
                                                <a th:href="@{/tags(tagId=${tag.id})}" th:each="tag: *{tags}" th:text="${tag.name}" class="label label-success duplicate-label"></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xs-4 li-center" th:classappend="${'auto-center-target-' + iterStat.count}">
                                        <a href="#">
                                            <img class="img-rounded img-responsive" th:src="*{cover}" alt="">
                                        </a>
                                    </div>
                                </div>
                            </li>
                        </ul>
                        <!-- bottom -->
                        <div class="panel panel-body panel-default">
                            <a class="btn btn-default pull-left" th:classappend="${(pages.current > 1 ? '' : 'disabled')}" type="button" th:href="@{/types(index=${pages.current - 1}, typeId = ${typeId})}">上一页</a>
                            <a class="btn btn-default pull-right" th:classappend="${(pages.current < pages.pages ? '' : 'disabled')}" type="button" th:href="@{/types(index=${pages.current + 1}, typeId = ${typeId})}">下一页</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- footer -->
        <footer th:replace="_fragment::footer"></footer>

        <script src="https://cdn.staticfile.org/jquery/3.2.0/jquery.min.js"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" ></script>
        <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>
        <script th:src="@{/js/common.js}"></script>
    </body>
</html>